package b2.scene.fight.skills
{
	import b2.scene.fight.PlayState;
	import b2.scene.fight.TankSprite;
	
	import flash.geom.Point;
	
	public class Blink extends BasicSkill
	{
		public function Blink(tankId:int, side:int, level:int, skillArgs:Object)
		{
			super(tankId, side, level, skillArgs);
		}
		
		public function isDamage():Boolean
		{
			var result:Boolean = true;
			if (skillArgs.effectValue != null && skillArgs.effectValue == 1)
				result = false;
			return result;
		}
		
		public override function checkSkillTriggerPremise(x:int, y:int, direction:int):Boolean
		{
			return false;
		}
		
		public function checkTime():Boolean
		{
			return coolDown <= 0;
		}
		
		public override function discharge(x:int, y:int, direction:int):void
		{
			var tank:TankSprite = getOwner();
			var p:Point = getPlayState().getRandEmptyPos();
			getPlayState().tankTweenLiteTo(tankId, 100, direction, x, y, PlayState.OFFSET_X + PlayState.TILE_WIDTH * p.x, PlayState.OFFSET_Y + PlayState.TILE_WIDTH * p.y, 1);
			super.discharge(x, y, direction);
		}
	}
}